<?php

$connect = mysql_connect("localhost", "root", "") or die ("Error , check your server connection.");
mysql_select_db("stms");
$result=mysql_query("SELECT * FROM new");
$totalRows= mysql_num_rows($result);
 
$result1=mysql_query("SELECT * FROM new WHERE id='$totalRows'");


$row=mysql_fetch_array($result1);
$id=$row['id']+1;
$n=$row['al']+1;
$ac1=$n+1;
$ac2=$ac1+1;
$ac=$ac1.'/'.$ac2;
if (isset($_GET['a'])){$check = $_GET['a'];}
mysql_query("insert into new (al,Academicyear,id) values ('$n','$ac','$id')");
	if($check=="aca")
	header("Location:http://localhost/stms/pages/showadmin.php?err1=$ac");
		//header("Location:http://localhost/stms/pages/showadmin.php?err2=$n");
	if($check=="al")
	header("Location:http://localhost/stms/pages/aladmin.php?err1=$ac");
?>